{% extends "light.twig" %}

{% block title %}: {{ vocab_id|upper }}: {% trans "Alphabetical index" %}: {{ letter }}{% endblock %}
{% block headernav %}
<ul class="nav nav-tabs">
  <li class="active"><a href="{{ path_fix }}{{ vocab_id }}/{{ lang }}/index">{% trans "Alpha-nav" %}</a></li>
  <li><a href="#" id="hier-trigger">{% trans "Hier-nav" %}</a></li>
  {% if vocab.groupClassURI %}
  <li><a href="{{ path_fix }}{{ vocab_id }}/{{ lang }}/groups">{% trans "Group-nav" %}</a></li>
  {% else %}
  {% endif %}
</ul>
{% endblock %}
{% block sidebar %}
<div class="container" id="alphabetical-menu">
{% set letters = 'A'..'Z' %} {# it would be nicer to do this according to the actual appearances of letters i.e. only letters with results should be shown #}
{% set rest = ['Å', 'Ä', 'Ö', '!*'] %}
  <ul class="pagination">
  {% for letter in [['0-9'], letters, rest] %} {# looping through all letters #}
    {%  for letter2 in letter %}
      <li{% if search_letter == letter2 %} class="active"{% endif %}><a href="{{ path_fix }}{{ vocab_id }}/{{ lang }}/index/{{ letter2 }}">{{ letter2 }}</a></li>
    {% endfor %}
  {% endfor %}
  </ul>
  {% if search_results %}
    {% set previous = '' %}
    <ul class="list-group alphabetical-search-results side-navi">
      {% for key,value in search_results %}
      {% if all_letters == true %}
        {% set alpha = value.prefLabel|first %}{% if alpha != previous %}<li class="alphabet-header" name="{{ alpha }}"><h5>{{ alpha }}</h5></li>{% set previous = alpha %}{% endif %}
      {% endif %}
      <li>
      {% if value.altLabel %}
      {{ value.altLabel }} 	&rarr; <a href="{{ value.uri | link_url(vocab,lang) }}">{{ value.prefLabel }}</a>
      {% else %}
      <a href="{{ value.uri | link_url(vocab,lang) }}">{{ value.prefLabel }}</a>
      {% endif %}
     </li>
      {% endfor %}
    </ul>
    {% else %}<span class="header-text-small-font">{% trans %}Error: the vocabulary does not contain terms beginning with "{{ letter }}"!{% endtrans %}</span>
  {% endif %}
</div>
{% endblock %}
{% block content %}
{% if lang_changed %}
  <div class="col-lg-10">
    <div class="alert alert-danger">
      <h4>{{ lang_changed }}</h4>
    </div>
  </div>
{% endif %}
{% endblock %}
